package io.mya.common.utils;


import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

public class GenNumbersUtil {

	public static String genNum(String code){
		SimpleDateFormat sdf = null;
		
		String num = "";
		synchronized(GenNumbersUtil.class){
			sdf = new SimpleDateFormat("YYYYMMddHHmmssSSS");
			if(SpecialUtil.isNotEmpty(code)){
				num += code;
			}
			num += sdf.format(new Date())+SpecialUtil.getRandomNum(6);
		}
		return num;
	}
	
	public static String genCaiMi(){
		synchronized(GenNumbersUtil.class){
			String code = UUID.randomUUID().toString().replaceAll("-", "").substring(0, 12);
			code = code+SpecialUtil.getRandomStr(8);
			//System.out.println(code.toUpperCase());
			//System.out.println(code.length());
			return code.toUpperCase();
		}
		
	}
	
	public static void main(String[] args) {
		System.out.println(genCaiMi());
	}
}
